package employe;

import java.io.Serializable;

public class Employe implements Serializable {
	

	private static final long serialVersionUID = 1L;
	private String nom;
	private String prenom;
	private String nationalite;
	private transient String pays;
	private double salaire;
	public String getNationalite() {
		return nationalite;
	}
	public void setNationalite(String nationalite) {
		this.nationalite = nationalite;
	}
	public String getPays() {
		return pays;
	}
	public void setPays(String pays) {
		this.pays = pays;
	}
	public double getSalaire() {
		return salaire;
	}
	public void setSalaire(double salaire) {
		this.salaire = salaire;
	}
	public String getNom() {
		return nom;
	}
	public String getPrenom() {
		return prenom;
	}
	@Override
	public String toString() {
		return "Employe [nom=" + nom + ", prenom=" + prenom + ", nationalite="
				+ nationalite + ", salaire=" + salaire + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((nationalite == null) ? 0 : nationalite.hashCode());
		result = prime * result + ((nom == null) ? 0 : nom.hashCode());
		result = prime * result + ((prenom == null) ? 0 : prenom.hashCode());
		long temp;
		temp = Double.doubleToLongBits(salaire);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Employe other = (Employe) obj;
		if (nationalite == null) {
			if (other.nationalite != null)
				return false;
		} else if (!nationalite.equals(other.nationalite))
			return false;
		if (nom == null) {
			if (other.nom != null)
				return false;
		} else if (!nom.equals(other.nom))
			return false;
		if (prenom == null) {
			if (other.prenom != null)
				return false;
		} else if (!prenom.equals(other.prenom))
			return false;
		if (Double.doubleToLongBits(salaire) != Double
				.doubleToLongBits(other.salaire))
			return false;
		return true;
	}
	public Employe(String nom, String prenom, String nationalite, double salaire) {
		super();
		this.nom = nom;
		this.prenom = prenom;
		this.nationalite = nationalite;
		this.salaire = salaire;
		if ("Britannique".equalsIgnoreCase(nationalite)){
			this.pays = "Grande Bretagne";
		}
		
	}
	

}
